package edu.jhu.cs.oose.scheduleit.services;

import java.util.List;
import edu.jhu.cs.oose.scheduleit.services.impl.DataBaseException;
import edu.jhu.cs.oose.scheduleit.util.Attribute;
import edu.jhu.cs.oose.scheduleit.util.JoinStatus;
import edu.jhu.cs.oose.scheduleit.vo.Group;
import edu.jhu.cs.oose.scheduleit.vo.User;

/**
 * An interface for service related to user
 * @author oose_group2
 *
 */
public interface UserService {
	
	/**
	 * Log a certain user to the system
	 * @param email	The email of the user
	 * @param password	The password of the user
	 * @return	The user logged
	 * @throws DataBaseException	If a DataBaseException occurred
	 */
	public User login(String email, String password) throws DataBaseException;
	
	/**
	 * Register a new user to the system
	 * @param attribute	The attribute of the new user
	 * @return	The user registered
	 * @throws DataBaseException	If a DataBaseException occurred
	 */
	public User register(Attribute attribute) throws DataBaseException;
	
	/**
	 * Update the information of a  certain user
	 * @param user	The user going to be updated
	 * @param attribute	The attribute of the user
	 * @throws DataBaseException	If a DataBaseException occurred
	 */
	public void update(User user, Attribute attribute) throws DataBaseException;
	
	/**
	 * Retrieve the groups satisfying given conditions
	 * @param user	The user who owns the objective groups
	 * @param status	The join status of objective groups
	 * @param offset	The offset of the first group in the list
	 * @param limit		The limit number of the objective groups
	 * @return	The groups satisfying given conditions
	 * @throws DataBaseException
	 */
	public List<Group> getGroup(User user, JoinStatus status, int offset, int limit) throws DataBaseException;
	
	/**
	 * Calculate how many groups of certain type, owned by a given user
	 * @param user	The user who owns the objective group
	 * @param status	The join status of the objective group
	 * @return	The number of how many groups satisfying the given conditions
	 * @throws DataBaseException	If a DataBaseException occurred
	 */
	public int getGroupCount(User user, JoinStatus status) throws DataBaseException;
	
	/**
	 * 
	 * @param email
	 * @return
	 * @throws DataBaseException
	 */
	public User getUser(String email) throws DataBaseException;
	
	
}
